package com.shuyuntu.proposal.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;

/**
 * 附议项的实体
 *
 * 附议类似一个评论
 * @author limeng
 * Created by limeng on 16/4/16.
 */
@Entity
@Table(name = "second_motion")
public class SecondMotion {
    public SecondMotion() {
    }

    /**
     * 附议的主键（自增）
     */
    private Integer id;

    /**
     * 对应的提案
     */
    @JsonIgnore
    private Proposal targetProposal;

    /**
     * 附议的作者
     */
    private Delegate author;

    /**
     * 附议的内容
     */
    private String content;


    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne(targetEntity = Proposal.class)
    @JoinColumn(name = "proposal_id", nullable = false)
    public Proposal getTargetProposal() {
        return targetProposal;
    }

    public void setTargetProposal(Proposal targetProposal) {
        this.targetProposal = targetProposal;
    }

    @ManyToOne(targetEntity = Delegate.class)
    @JoinColumn(name = "author_id", nullable = false)
    public Delegate getAuthor() {
        return author;
    }

    public void setAuthor(Delegate author) {
        this.author = author;
    }

    @Column(length = 1000, nullable = false)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }
}
